package rpc.simple.impl.tag2.consumer;

import rpc.simple.impl.exception.SimpleRpcFrameworkException;
import rpc.simple.impl.tag2.SimpleRpcFramework;
import rpc.simple.impl.service.HelloService;

/**
 * XXX
 *
 * @author mengzhang6
 * @date 2019/1/3 9:16
 */
public class RpcConsumer {

    public static void main(String[] args) throws Exception {
        HelloService service = SimpleRpcFramework.refer(HelloService.class, "127.0.0.1", 8084);

        if (service == null) {
            throw new SimpleRpcFrameworkException("服务提供者异常");
        }
        for (int i = 0; i < Integer.MAX_VALUE; i++) {
            String hello = service.sayHello("World" + i);
            System.out.println(hello);
            Thread.sleep(500);
        }
    }
}
